package com.candy.utils;

import org.aspectj.lang.ProceedingJoinPoint;

public class MyLogging {
    public void beforeMethod(){
        System.out.println("方法执行前...");
    }
    public void afterMethod(){
        System.out.println("方法执行后...");
    }

    public Object arroundLogging(ProceedingJoinPoint pjt){
        Object obj=null;
        try {
            System.out.println("环绕通知开始。。。。。");
//        获取执行方法的参数
            Object[] args=pjt.getArgs();
            obj=pjt.proceed(args);
            System.out.println("环绕通知结束.....");
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
        return obj;
    }


    public void sucessMethod(){
        System.out.println("方法执行成功...");
    }

    public void exceptionMthod(){
        System.out.println("方法出现异常");
    }
}
